Function: matlab2javadateformat

CALL:

format = matlab2javadateformat(format)

DESCRIPTION:

Convert string with matlab dateformat to a java dateformat, mainly to use with tables.

INPUT:

   format: string with matlab dateformat
  

OUTPUT:

   format: string with java dateformat
  

APPROACH:

  Matlab format:
      yyyy    full year, e.g. 1990, 2000, 2002
      yy      partial year, e.g. 90, 00, 02
      mmmm    full name of the month, according to the calendar locale, e.g.
              "March", "April" in the UK and USA English locales. 
      mmm     first three letters of the month, according to the calendar 
              locale, e.g. "Mar", "Apr" in the UK and USA English locales. 
      mm      numeric month of year, padded with leading zeros, e.g. ../03/..
              or ../12/.. 
      m       capitalized first letter of the month, according to the
              calendar locale; for backwards compatibility. 
      dddd    full name of the weekday, according to the calendar locale, e.g.
              "Monday", "Tuesday", for the UK and USA calendar locales. 
      ddd     first three letters of the weekday, according to the calendar
              locale, e.g. "Mon", "Tue", for the UK and USA calendar locales. 
      dd      numeric day of the month, padded with leading zeros, e.g. 
              05/../.. or 20/../.. 
      d       capitalized first letter of the weekday; for backwards 
              compatibility
      HH      hour of the day, according to the time format. In case the time
              format AM | PM is set, HH does not pad with leading zeros. In 
              case AM | PM is not set, display the hour of the day, padded 
              with leading zeros. e.g 10:20 PM, which is equivalent to 22:20; 
              9:00 AM, which is equivalent to 09:00.
      MM      minutes of the hour, padded with leading zeros, e.g. 10:15, 
              10:05, 10:05 AM.
      SS      second of the minute, padded with leading zeros, e.g. 10:15:30,
              10:05:30, 10:05:30 AM. 
      FFF     milliseconds field, padded with leading zeros, e.g.
              10:15:30.015.
      PM      set the time format as time of morning or time of afternoon. AM 
              or PM is appended to the date string, as appropriate. 
 
  Java format
 
  G  Era designator  Text  AD
  y  Year  Year  1996; 96
  M  Month in year  Month  July; Jul; 07
  w  Week in year  Number  27
  W  Week in month  Number  2
  D  Day in year  Number  189
  d  Day in month  Number  10
  F  Day of week in month  Number  2
  E  Day in week  Text  Tuesday; Tue
  a  Am/pm marker  Text  PM
  H  Hour in day (0-23)  Number  0
  k  Hour in day (1-24)  Number  24
  K  Hour in am/pm (0-11)  Number  0
  h  Hour in am/pm (1-12)  Number  12
  m  Minute in hour  Number  30
  s  Second in minute  Number  55
  S  Millisecond  Number  978
  z  Time zone  General time zone  Pacific Standard Time; PST; GMT-08:00
  Z  Time zone  RFC 822 time zone  -0800
 
  Conversion table:
  y -> y
  m -> M
  M -> m
  d -> d
  H -> H
  S -> s
  F -> S
  PM -> a
  
  EXAMPLE
      format = matlab2javadateformat('dd-mmm-yyyy HH:MM:SS')